package net.dgg.dggcloud.service.jrcrm.utils;


import net.dgg.dggcloud.service.common.exception.BizException;
import net.dgg.dggcloud.service.common.util.HttpUtility;

import java.net.URLEncoder;
import java.util.HashMap;
import java.util.Map;

/**
 * 发送短信-漫道
 * 
 * @author 汤宏
 * 
 */
public class SmsManDao {


	public String sendMsg(String mobile, String content) {
		try {
			content = "【顶呱呱集团】"+content;
			content = URLEncoder.encode(content, "utf-8");
			String url = "http://sdk.entinfo.cn:8061/webservice.asmx/mdsmssend";
			Map params = new HashMap();
			params.put("sn", "SDK-WSS-010-09391");
			params.put("pwd", "DFD5A3C3573B850BE0991C6C1EA5B4EC");
			params.put("mobile", mobile);
			params.put("content", content);
			params.put("ext", "3");
			params.put("stime", "");
			params.put("rrid", "");
			params.put("msgfmt", "");
			String result = HttpUtility.postRest(url, params);
			return result;
		} catch (Exception e) {
			throw new BizException("短信发送失败",10001);
		}

	}

	public static void main(String[] args) {
		SmsManDao s = new SmsManDao();
		String body = s.sendMsg("18613236735", "测试消息：测试");
		System.out.println(body);
	}
}
